//
//  BSHomeTitleButton.swift
//  mySwiftWeibo
//
//  Created by apple on 16/7/25.
//  Copyright © 2016年 itcast沈庆伟. All rights reserved.
//

import UIKit

class BSHomeTitleButton: UIButton {

    convenience init(title: String){
        self.init(frame: CGRectZero)
        
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        self.sizeToFit()
    }
    
    //在layoutSubviews中重布局
    override func layoutSubviews() {
        super.layoutSubviews()
        
        self.titleLabel?.frame.origin.x=0
        
        self.imageView?.frame.origin.x=self.titleLabel!.frame.width+4
    }
    
    
}
